package cn.iocoder.yudao.module.system.dal.mysql.productionplandetail;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.productionplandetail.ProductionPlanDetailDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.productionplandetail.vo.*;

/**
 * 生产计划详情 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface ProductionPlanDetailMapper extends BaseMapperX<ProductionPlanDetailDO> {

    default PageResult<ProductionPlanDetailDO> selectPage(ProductionPlanDetailPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProductionPlanDetailDO>()
                .eqIfPresent(ProductionPlanDetailDO::getPlanId, reqVO.getPlanId())
                .eqIfPresent(ProductionPlanDetailDO::getCustomerId, reqVO.getCustomerId())
                .likeIfPresent(ProductionPlanDetailDO::getSupplierName, reqVO.getSupplierName())
                .likeIfPresent(ProductionPlanDetailDO::getCustomerName, reqVO.getCustomerName())
                .likeIfPresent(ProductionPlanDetailDO::getProductName, reqVO.getProductName())
                .eqIfPresent(ProductionPlanDetailDO::getSpecification, reqVO.getSpecification())
                .eqIfPresent(ProductionPlanDetailDO::getRack, reqVO.getRack())
                .eqIfPresent(ProductionPlanDetailDO::getRackNumber, reqVO.getRackNumber())
                .eqIfPresent(ProductionPlanDetailDO::getSingleHangingQuantity, reqVO.getSingleHangingQuantity())
                .eqIfPresent(ProductionPlanDetailDO::getSubgroup, reqVO.getSubgroup())
                .eqIfPresent(ProductionPlanDetailDO::getCpDefectNum, reqVO.getCpDefectNum())
                .eqIfPresent(ProductionPlanDetailDO::getFinishedProductNum, reqVO.getFinishedProductNum())
                .eqIfPresent(ProductionPlanDetailDO::getMaximumQuantity, reqVO.getMaximumQuantity())
                .eqIfPresent(ProductionPlanDetailDO::getPlannedQuantity, reqVO.getPlannedQuantity())
                .eqIfPresent(ProductionPlanDetailDO::getNotes, reqVO.getNotes())
                .betweenIfPresent(ProductionPlanDetailDO::getGoodDate, reqVO.getGoodDate())
                .eqIfPresent(ProductionPlanDetailDO::getDifferenceType, reqVO.getDifferenceType())
                .betweenIfPresent(ProductionPlanDetailDO::getDeliveryDate, reqVO.getDeliveryDate())
                .eqIfPresent(ProductionPlanDetailDO::getIssuedBatchNumber, reqVO.getIssuedBatchNumber())
                .eqIfPresent(ProductionPlanDetailDO::getIssued, reqVO.getIssued())
                .betweenIfPresent(ProductionPlanDetailDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ProductionPlanDetailDO::getId));
    }

}
